/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.ui.dialogs;

import java.io.File;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

import com.cea.papyrus.core.utils.Debug;

/**
 * 
 * 
 * @author Patrick Tessier
 * 30 juin 06
 * @deprecated
 */

@Deprecated
public class ChooseModelFileDialog extends ChooseDialog  implements IChooseDialog{
	
	/**
	 * 
	 */
	File[] allFiles;
	
	/**
	 * 
	 * 
	 * @param parentShell 
	 */
	public ChooseModelFileDialog(Shell parentShell){
		super(parentShell);
		announce="Select the file:";
		//allFiles=Manager.getRessourceManager().lookForModelFile();
		
		
		elementList = new String[allFiles.length];
		
		
		for(int i=0;i<allFiles.length;i++){
			elementList[i]=" "+allFiles[i].getName()+"     ";
		}

	}
	
	/**
	 * 
	 * 
	 * @param parent 
	 * 
	 * @return 
	 */
	@Override
	protected Control createDialogArea(Composite parent){
		Composite comp=(Composite)super.createDialogArea(parent);
		return comp;
	}
	
	/**
	 * 
	 * 
	 * @param parent 
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent){
		super.createButtonsForButtonBar(parent);
		
	}
	
	/**
	 * 
	 * 
	 * @param buttonId 
	 */
	@Override
	protected void buttonPressed(int buttonId){
		super.buttonPressed(buttonId);
	}
	
	/**
	 * 
	 */
	@Override
	protected void okPressed(){
		Debug.debug(this,"ChooseDialog.okPressed "+combo.getSelectionIndex(), channel);
		int i=combo.getSelectionIndex();
		IWorkspace workspace= ResourcesPlugin.getWorkspace();
	       IPath location= Path.fromOSString(allFiles[i].getAbsolutePath());
	       IFile file= workspace.getRoot().getFileForLocation(location);
	       //Manager.getRessourceManager().addFile(file);
	      
		super.okPressed();
	}

}
